//
//  BillDetailView.m
//  YTwallet
//
//  Created by ZhangLin on 2019/3/21.
//  Copyright © 2019年 hadrlog. All rights reserved.
//

#import "BillDetailView.h"
#import <Masonry.h>
@implementation BillDetailView

-(instancetype)initWithFrame:(CGRect)frame{
    if (self = [super initWithFrame:frame]) {
        [self setupViews];
    }
    return self;
}

-(void)setupViews{
    
    self.topView = [[UIView alloc] init];
    self.topView.backgroundColor = [UIColor whiteColor];
    [self addSubview:self.topView];
    [self.topView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(0);
        make.right.mas_equalTo(0);
        make.top.mas_equalTo(0);
        make.height.mas_equalTo(200);
    }];
    
    self.imv = [[UIImageView alloc] init];
    self.imv.image = [UIImage imageNamed:@"bill_icon_card"];
    [self.topView addSubview:self.imv];
    [self.imv mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.mas_equalTo(25);
        make.centerX.equalTo(self);
        make.width.mas_equalTo(38);
        make.height.mas_equalTo(38);
    }];
    
    self.accountNumLab = [[UILabel alloc] init];
    self.accountNumLab.text = @"￥39.00";
    self.accountNumLab.textColor = [UIColor blackColor];
    self.accountNumLab.font = [UIFont systemFontOfSize:28.0f];
    [self.topView addSubview:self.accountNumLab];
    [self.accountNumLab mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerX.equalTo(self);
        make.top.equalTo(self.imv.mas_bottom).offset(20);
    }];
    
    self.consumeSuccessLab = [[UILabel alloc] init];
    self.consumeSuccessLab.text = @"交易成功";
    self.consumeSuccessLab.textColor = [UIColor colorWithRed:51 / 255.0 green:51 / 255.0 blue:51 / 255.0 alpha:1];
    self.consumeSuccessLab.font = [UIFont systemFontOfSize:14.0f];
    [self.topView addSubview:self.consumeSuccessLab];
    [self.consumeSuccessLab mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerX.equalTo(self);
        make.top.equalTo(self.accountNumLab.mas_bottom).offset(5);
    }];
    
    self.lineView = [[UIView alloc] init];
    self.lineView.backgroundColor = [UIColor colorWithRed:229 / 255.0 green:229 / 255.0 blue:229 / 255.0 alpha:1];
    [self addSubview:self.lineView];
    [self.lineView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(15);
        make.right.mas_equalTo(-15);
        make.height.mas_equalTo(1);
        make.bottom.equalTo(self.topView);
    }];
    
    
    self.midView = [[UIView alloc] init];
    self.midView.backgroundColor = [UIColor whiteColor];
    [self addSubview:self.midView];
    [self.midView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(0);
        make.right.mas_equalTo(0);
        make.top.equalTo(self.topView.mas_bottom);
        make.height.mas_equalTo(180);
    }];
    
    
    self.consumeTypeLab = [[UILabel alloc] init];
    self.consumeTypeLab.text = @"交易类型";
    self.consumeTypeLab.textColor = [UIColor colorWithRed:153 / 255.0 green:153 / 255.0 blue:153 / 255.0 alpha:1];
    self.consumeTypeLab.font = [UIFont systemFontOfSize:14.0f];
    [self.midView addSubview:self.consumeTypeLab];
    [self.consumeTypeLab mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(15);
    }];
    
    self.receiptCardLab = [[UILabel alloc] init];
    self.receiptCardLab.text = @"收款卡";
    self.receiptCardLab.textColor = [UIColor colorWithRed:153 / 255.0 green:153 / 255.0 blue:153 / 255.0 alpha:1];
    self.receiptCardLab.font = [UIFont systemFontOfSize:14.0f];
    [self.midView addSubview:self.receiptCardLab];
    [self.receiptCardLab mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.consumeTypeLab);
    }];
    
    self.orderNumLab = [[UILabel alloc] init];
    self.orderNumLab.text = @"订单编号";
    self.orderNumLab.textColor = [UIColor colorWithRed:153 / 255.0 green:153 / 255.0 blue:153 / 255.0 alpha:1];
    self.orderNumLab.font = [UIFont systemFontOfSize:14.0f];
    [self.midView addSubview:self.orderNumLab];
    [self.orderNumLab mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.consumeTypeLab);
    }];
    
    self.tradeTimeLab = [[UILabel alloc] init];
    self.tradeTimeLab.text = @"交易时间";
    self.tradeTimeLab.textColor = [UIColor colorWithRed:153 / 255.0 green:153 / 255.0 blue:153 / 255.0 alpha:1];
    self.tradeTimeLab.font = [UIFont systemFontOfSize:14.0f];
    [self.midView addSubview:self.tradeTimeLab];
    [self.tradeTimeLab mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.consumeTypeLab);
    }];
    
    NSMutableArray *verticalArray = [NSMutableArray array];
    [verticalArray addObject:self.consumeTypeLab];
    [verticalArray addObject:self.receiptCardLab];
    [verticalArray addObject:self.orderNumLab];
    [verticalArray addObject:self.tradeTimeLab];
    
    [verticalArray mas_distributeViewsAlongAxis:(MASAxisTypeVertical) withFixedSpacing:0 leadSpacing:0 tailSpacing:0];
    
    
    
    
    
    
    self.consumeValueTypeLab = [[UILabel alloc] init];
    self.consumeValueTypeLab.text = @"快捷支付";
    self.consumeValueTypeLab.textColor = [UIColor colorWithRed:51 / 255.0 green:51 / 255.0 blue:51 / 255.0 alpha:1];
    self.consumeValueTypeLab.font = [UIFont systemFontOfSize:14.0f];
    [self.midView addSubview:self.consumeValueTypeLab];
    [self.consumeValueTypeLab mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.consumeTypeLab.mas_right).offset(20);
    }];
    
    
    self.receiptValueCardLab = [[UILabel alloc] init];
    self.receiptValueCardLab.text = @"中国工商银行(尾号0822)";
    self.receiptValueCardLab.textColor = [UIColor colorWithRed:51 / 255.0 green:51 / 255.0 blue:51 / 255.0 alpha:1];
    self.receiptValueCardLab.font = [UIFont systemFontOfSize:14.0f];
    [self.midView addSubview:self.receiptValueCardLab];
    [self.receiptValueCardLab mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.consumeValueTypeLab);
    }];
    
    self.orderValueNumLab = [[UILabel alloc] init];
    self.orderValueNumLab.text = @"1234789126471982";
    self.orderValueNumLab.textColor = [UIColor colorWithRed:51 / 255.0 green:51 / 255.0 blue:51 / 255.0 alpha:1];
    self.orderValueNumLab.font = [UIFont systemFontOfSize:14.0f];
    [self.midView addSubview:self.orderValueNumLab];
    [self.orderValueNumLab mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.consumeValueTypeLab);
    }];
    
    self.tradeTimeValueLab = [[UILabel alloc] init];
    self.tradeTimeValueLab.text = @"2018-05-02 11:23:43";
    self.tradeTimeValueLab.textColor = [UIColor colorWithRed:51 / 255.0 green:51 / 255.0 blue:51 / 255.0 alpha:1];
    self.tradeTimeValueLab.font = [UIFont systemFontOfSize:14.0f];
    [self.midView addSubview:self.tradeTimeValueLab];
    [self.tradeTimeValueLab mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.consumeValueTypeLab);
    }];
    
    NSMutableArray *verticalValueArray = [NSMutableArray array];
    [verticalValueArray addObject:self.consumeValueTypeLab];
    [verticalValueArray addObject:self.receiptValueCardLab];
    [verticalValueArray addObject:self.orderValueNumLab];
    [verticalValueArray addObject:self.tradeTimeValueLab];
    
    [verticalValueArray mas_distributeViewsAlongAxis:(MASAxisTypeVertical) withFixedSpacing:0 leadSpacing:0 tailSpacing:0];
    
    
    self.CCopyBtn = [UIButton buttonWithType:(UIButtonTypeCustom)];
    [self.CCopyBtn setTitle:@"复制" forState:(UIControlStateNormal)];
    [self.CCopyBtn setTitleColor:[UIColor colorWithRed:91 / 255.0 green:113 / 255.0 blue:255 / 255.0 alpha:1] forState:(UIControlStateNormal)];
    self.CCopyBtn.titleLabel.font = [UIFont systemFontOfSize:14];
    [self.midView addSubview:self.CCopyBtn];
    [self.CCopyBtn mas_makeConstraints:^(MASConstraintMaker *make) {
        make.right.mas_equalTo(-20);
        make.centerY.equalTo(self.orderValueNumLab);
    }];
    
    
    
}

@end
